package com.zy.springboot.service.system;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zy.springboot.dao.system.YzmDao;
import com.zy.springboot.entity.user.YzmEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * Created by y on 2019/1/11.
 */

@Service
@Transactional(rollbackFor = Exception.class)
public class YzmServiceImpl implements YzmService {
    @Autowired
    private YzmDao yzmDao;

    @Override
    public String add(String jsonData) {
        JSONObject JSONObject = JSON.parseObject(jsonData);
        YzmEntity yzmEntity = JSON.toJavaObject(JSONObject, YzmEntity.class);
        yzmDao.add(yzmEntity);
        return yzmEntity.getId();
    }

}